package cn.com.basic.framework.web.base.request;

import lombok.Data;

import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;

/**
 * @Author Cuixk
 * 2020/1/9 09:38
 */
@Data
public class BaseQueryPage {

    private Integer page = 1;

    private Integer pageSize = 10;

    private Integer firstResult;

    /**
     * 查询条件  key为字段   前端传参为 p_字段
     */
    private Map<String, Object> condition = new HashMap<>();

    /**
     * 模糊查询条件  key为字段   前端传参为 s_字段
     */
    private Map<String, String> searchCondition = new HashMap<>();

    /**
     * 范围条件 key为{条件}_字段    gt_开头大于   ge_开头大于等于   lt开头小于 le_开头小于等于
     */
    private Map<String, Object> rangeCondition = new HashMap<>();

    /**
     * 排序条件 key为字段 value为true为正序  前端传参为 o_顺序(可选)+字段    如 o_priority=T 或  o_0priority=T
     */
    private Map<String, Boolean> orderByCondition = new TreeMap<>();

    private boolean needCount = true;

    public BaseQueryPage(boolean needCount) {
        this.needCount = needCount;
    }

    public BaseQueryPage(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public BaseQueryPage() {
    }

}
